package appconfig

import (
	"fmt"
	"github.com/spf13/viper"
)

type MysqlConfig struct {
	User     string
	Password string
	Host     string
	Port     int64
	DBName   string
}
type SendConfig struct {
	AccessKeyId     string
	AccessKeySecret string
}
type RedisConfig struct {
	Password string
	Host     string
	Port     int64
	DBName   int64
}
type JwtConfig struct {
	AccessSecret string
	AccessExpire int64
}
type RealAuthConfig struct {
	SecretId  string
	SecretKey string
}
type UploadConfig struct {
	AccessKey string
	SecretKey string
}
type AppConfig struct {
	MysqlConfig
	SendConfig
	RedisConfig
	JwtConfig
	RealAuthConfig
	UploadConfig
}

var AppConf1 AppConfig

func InitConfig() {
	viper.SetConfigFile("../user-srv/appconfig/local.yaml")
	viper.ReadInConfig()
	viper.Unmarshal(&AppConf1)
	fmt.Println(AppConf1)
}
